/**
 * 发送消息给worker
 */
interface SendWorkerMessage<T = any> {
  readonly type: 'send'
  readonly data?: T
}

/**
 * 接收来自worker的消息
 */
interface ReplyWorkerMessage<T = any> {
  readonly type: 'success'
  readonly data: T
}

/**
 *  转码worker发送的数据
 */
interface TranscodeWorkerSendWorkerData {
  uuid: string
  original: string
}

/**
 * 转码worker发送的消息
 */
type TranscodeWorkerSendWorkerMessage = SendWorkerMessage<TranscodeWorkerSendWorkerData>

/**
 * 转码worker接收的消息
 */
type TranscodeWorkerReplyWorkerMessage = ReplyWorkerMessage<{
  audioData: Array<number>
  uuid: string
}>

export type {
  ReplyWorkerMessage,
  SendWorkerMessage,
  TranscodeWorkerReplyWorkerMessage,
  TranscodeWorkerSendWorkerData,
  TranscodeWorkerSendWorkerMessage,
}
